{template header}

    {template title}
    <!-- box begin -->
    <div class="box">
        <!--{if $a == 'index'}-->
        <form method="post">
            <table cellpadding="1" cellspacing="1" width="100%" border="0">
                <tr>
                    <th width="8%">排序</th>
                    <th class="td2">{$this->name}名称</th>
                    <th width="16%">操作</th>
                </tr>
            <!--{if $this->sort_list}-->
                <!--{loop $this->sort_list $val}-->
                <tr>
                    <td><input type="text" class="span0" name="oid[{$val['id']}]" value="{$val['oid']}" /></td>
                    <td class="td2"><div class="node{$val['node']}">{$val["title"]}</div></td>
                    <td>
                        <a class="btn btn-mini" href="{$this->url( $c, 'edit', array('id' => $val['id']) )}">编辑</a>
                        <a class="btn btn-mini btn-success" href="{$this->url( $c, 'add', array('id' => $val['id']) )}">添加</a>
                        <a title="删除{$this->name}" tip="删除{$this->name}同时,会把该{$this->name}下的文章也删除。" class="del btn btn-mini btn-danger" href="{$this->url( $c, 'del', array('id' => $val['id']) )}">删除</a>
                    </td>
                </tr>
                <!--{/loop}-->
            <!--{else}-->
                <tr>
                    <td colspan="3">没有{$this->name}!</td>
                </tr>
            <!--{/if}-->
                <tr>
                    <td>
                        <a href="#" title="更新排序" class="oid btn btn-small btn-info">排序</a>
                    </td>
                    <td colspan="2" class="td6">
                        <a class="btn btn-success" href="{$this->url($c, 'add' )}">添加{$this->name}</a>
                    </td>
                </tr>
            </table>
        </form>
        <script type="text/javascript">
            $( ".oid" ).click( function () {
                var url = "{$this->url($c)}&a=oid";
                $("form" ).attr( 'action', url );
                ajaxPOST( $( this ) );
                return false;
            });
        </script>
    <!--{/if}-->
    <!--{if $a == 'add' || $a == 'edit' }-->
        <form method="post" action="{$this->url($c, 'save' )}">
            <input type="hidden" name="model" value="article" />
        <!--{if $a == 'add'}-->
            <input type="hidden" name="sid" value="{echo R( 'id' )}" />
        <!--{else}-->
            <input type="hidden" name="id" value="{$result['id']}" />
        <!--{/if}-->
            <table cellpadding="1" cellspacing="1" width="100%" border="0">
                <tr>
                    <td width="25%">{$this->name}名称：</td>
                    <td class="td2">
                        <input type="text" name="title" class="required" placeholder="请输入{$this->name}名称" value="{$a == 'edit' ? $result['title'] : ''}"/>
                    </td>
                </tr>
            <!--{if $a == 'edit'}-->
                <tr>
                    <td>上级{$this->name}：</td>
                    <td class="td2">
                        <select name="sid" style="width: 160px;">
                            <option value="0">一级{$this->name}</option>
                        <!--{loop $this->sort_list $tree}-->
                            <!--{if $result['id'] != $tree['id']}-->
                            <option value="{$tree['id']}"{$tree['id'] == $result['sid'] ? ' selected' : ''}>{$tree['treeTitle']}</option>
                            <!--{/if}-->
                        <!--{/loop}-->
                        </select>
                    </td>
                </tr>
            <!--{/if}-->
                <tr>
                    <td>{$this->name}别名：</td>
                    <td class="td2">
                        <input type="text" name="alias" class="username" value="{$a == 'edit' ? $result['alias'] : ''}"/>
                    </td>
                </tr>
                <tr>
                    <td>{$this->name}关键词：</td>
                    <td class="td2">
                        <textarea name="keyword" class="span4">{$a == 'edit' ? $result['keyword'] : ''}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>{$this->name}描述：</td>
                    <td class="td2">
                        <textarea name="description" class="span4">{$a == 'edit' ? $result['description'] : ''}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>{$this->name}排序：</td>
                    <td class="td2">
                        <input type="text" class="span1 isint" name="oid" value="{$a == 'edit' ? $result['oid'] : '0'}"/>
                        <span class="lable">值越小越靠前</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="td3">
                        <a title="保存{$this->name}" class="btn btn-success save" href="{$this->url($c)}">保 存</a>
                    </td>
                </tr>
            </table>
            </form>
        <!--{/if}-->
    </div>
    <!-- box end -->
{template footer}